﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;

namespace MockupDesigner.AppItems.Commands
{
    public class ExportMetadatasCommand : ICommand
    {
        public CommandType CommandType
        {
            get { return CommandType.NonDisturbing; }
        }

        public void Execute(object target, params object[] parameters)
        {
            if (!(target is DesignerCanvas))
            {
                throw new InvalidCastException("The target must be a DesignerCanvas");
            }
            SaveFileDialog saveFile = new SaveFileDialog();
            saveFile.Title = "Export Metadatas";
            saveFile.Filter = "Files (*.csv)|*.csv";
            if (saveFile.ShowDialog() == true)
            {
                ((DesignerCanvas)target).SerializationService.SerializeMetadatas(saveFile.FileName);
            }
        }


        public void Redo()
        {
            // Nothing to do
        }

        public void Undo()
        {
            // Nothing to do
        }
    }
}
